package com.quartet.utils.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 运营商 1：电信 2：移动 3：联通
 * </p>
 * @author Zheng Jie
 * @date 2020-05-07
 */
@Getter
@AllArgsConstructor
public enum OperatorsEnum {

    TELECOM("1", "电信"),
    MOBILE("2", "移动"),
    UNICOM("3", "联通");
    private final String value;
    private final String description;

    public static OperatorsEnum find(String val) {
        for (OperatorsEnum operatorsEnum : OperatorsEnum.values()) {
            if (val.equals(operatorsEnum.getValue())) {
                return operatorsEnum;
            }
        }
        return null;
    }

    public static List<String> getValues() {
        return Arrays.stream(OperatorsEnum.values()).map(OperatorsEnum::getValue).collect(Collectors.toList());
    }
}
